#include "Player.h"
#include "SmurfsRenderManager.h"
#include "SmurfsPhysicsManager.h"

Player::Player(Sphere* ballBody, Mesh* ballMesh) : Entity(ballMesh, ballBody) {
	moveSpeed = 20.0f;
	
	// initialize the timer
	timer = Timer();
	timer.setupTimer();
	timer.setStartTime();

	RenderManager::getSingletonPtr()->addToScene(mesh);
	PhysicsManager::getSingletonPtr()->addToWorld(rigidBody);
}

Player::~Player(void) { }

void Player::move(Vector3 moveVector) {
	//moveVector = moveVector; //* moveSpeed * deltaTime; 
	Entity::move(moveVector * -1.0f);

}

/**************************************************************************************************
* Updates the player each frame
**************************************************************************************************/
void Player::update(void) {
	// get delta time
	deltaTime = timer.getDeltaTime();

//	glm::vec3 pos = glm::vec3(rigidBody->center.x, rigidBody->center.y, rigidBody->center.z);
//	mesh->modelMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(pos));

/*	// update view matrix
	viewMatrix = glm::mat4(1.0f);
	// rotate the matrix
	viewMatrix *= glm::rotate(glm::mat4(1.0f), rotationAngle.x, glm::vec3(1.0f, 0.0f, 0.0f));
	viewMatrix *= glm::rotate(glm::mat4(1.0f), rotationAngle.y, glm::vec3(0.0f, 1.0f, 0.0f));
	viewMatrix *= glm::rotate(glm::mat4(1.0f), rotationAngle.z, glm::vec3(0.0f, 0.0f, 1.0f));
	// translate the matrix
	viewMatrix *= glm::translate(glm::mat4(1.0f), -position);
*/
}